package com.jj.service;

import com.jj.entity.menu;
import com.jj.mapper.MenuMapper;

import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.awt.*;
import java.util.List;

@Service
public class MenuServiceimpl implements MenuService {

    @Resource
    private MenuMapper menuMapper;

    @Override
    public List<menu> selectaAll() {
        List<menu> menus = menuMapper.selectaAll();
        return menus;
    }

    @Override
    public int insertadd(menu m) {
        int insertadd = menuMapper.insertadd(m);
        return insertadd;
    }

    @Override
    public int deleteshan(int menu_id) {
        return menuMapper.deleteshan(menu_id);
    }

    @Override
    public int updatexiu(menu m) {

        return  menuMapper.updatexiu(m);
    }

//    @Override//递归
//    public List<menu> hqmenuqb(String pid) {
//        List<menu> menuAll = menuMapper.hqmenuqb(pid);
//        System.out.println(menuAll);
//        if (!menuAll.isEmpty()){
//            for (menu menu : menuAll) {
//                menu.setMenuList(hqmenuqb(menu.getMenu_id()+""));
//            }
//        }
//        return menuAll;
//    }

    public List<Menu> hqmenuAll(String pid){
        return menuMapper.hqmenuAll(pid);
    }
}
